<?php
session_start();
include 'CheckLogin.php';
?>   
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>NAPFA System</title>
    <link rel="stylesheet" href="napfa.css"/>
    <script src="SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
    <link href="SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" />
    <?php include 'CSSFunction.php'; ?>
</head>

<body onload="MM_preloadImages('Images/4.jpg','Images/Picture2hove.jpg','Images/Picture3hove.jpg','Images/welcome_graphic3hove.jpg','Images/OliveHOvber.jpg')">
    <div class="Wrapper" id="Wrapper"><center>

            <?php
            include 'Banner.php';
            include 'Header.php';
            require_once 'Function.php';
            ?>
            <?php
            $submiteed = $_POST['formSubmitted'];
            $name = $_POST['name'];
            $nric = $_POST['nric'];
            $gender = $_POST['gender'];
            $staffid = $_POST['staffid'];
            $courseList = stripcslashes($_POST['courseList']);
            $email = $_POST['email'];
            $roleList = $_POST['roleList'];
            if ($courseList == 'BIA') {
                $course = 'Business Intelligence & Analytics';
            } elseif ($courseList == 'CDS') {
                $course = 'Cyber & Digital Security';
            } elseif ($courseList == 'GET') {
                $course = 'Game & Entertainment Technology';
            } elseif ($courseList == 'FBI') {
                $course = 'Financial Business Informatics';
            } elseif ($courseList == 'IT') {
                $course = 'Information Technology';
            } elseif ($courseList == 'IMI') {
                $course = 'Interactive Media Informatics';
            } elseif ($courseList == 'MNS') {
                $course = 'Mobile & Network Services';
            } elseif ($courseList == 'DF') {
                $course = 'Digital Forensics';
            }
            if ($submiteed) {
                $pass = sha1('123');
                AddNewLecturer($name, $nric, $staffid, $course, $gender, $email, $roleList, $pass);
            }
            ?>
            <div id="apDiv21">
                <p align="left">National Physical Fitness Assessment (NAPFA)</p>
            </div>

            <div id="apDiv23"><img src="Images/horizontalLine.jpg" width="400" height="1" />

            </div>
            <form id="form2" name="form2" method="post" action="CreateNewLec.php">
                <div id="apDiv26">
                    <b><p align="left" >Add User<?php echo $_SESSION['role']; ?></p></b>
                    <p align="left">Click on the following to add users into the NAPFA System.</p>
                    <p align="left">Thank you.</p>
                </div>
                <div id="apDiv37">
                    <div class="AddUser">
                        <p align="left"><b>Add New User</b></p>
                        <p align="left"><img src="Images/horizontalLine.jpg" width="400" height="1" /></p>
                    </div>

                    <div id="apDiv38" align="left">
                        <p><b>Type in the text box to enter new user.</b></p><br/>

                        <div id="apDiv39">
                            <label for="tbxName">Name:</label>
                            <input type="text" name="name" id="tbxName" />
                            <?php echo $name, $nric, $staffid, $course, $gender, $email, $roleList, $pass; ?>
                        </div>
                        <div id="apDiv40">
                            <label for="tbxNRIC">NRIC No:</label>
                            <input type="text" name="nric" id="tbxNRIC" />
                        </div>
                        <div id="apDiv41">
                            <label for="tbxGender:">Gender:</label>
                            Male <input type="radio" name="gender" id="tbxGender:" value="Male"/>
                            Female <input type="radio" name="gender" id="tbxGender:" value="Female"/>
                        </div>
                        <div id="apDiv42">
                            <label for="tbxStaffID">Staff ID:</label>
                            <input type="text" name="staffid" id="tbxStaffID" />
                        </div>
                        <div id="apDiv43">
                            <label for="tbxCourse">Course:</label>
                            <select name="courseList" id="tbxCourse">
                                <option value="BIA">Business Intelligence &amp; Analytics</option>
                                <option value="CDS">Cyber &amp; Digital Security</option>
                                <option value="GET">Game &amp; Entertainment Technology</option>
                                <option value="FBI">Financial Business Informatics</option>
                                <option value="IT">Information Technology</option>
                                <option value="IMI">Interactive Media Informatics</option>
                                <option value="MNS">Mobile &amp; Network Services</option>
                                <option value="DF">Digital Forensics</option>
                            </select>
                        </div>
                        <div id="apDiv44">
                            <label for="tbxEmail">Email:</label>
                            <input type="text" name="email" id="tbxEmail" />
                        </div>                            
                        <div id="apDiv45">
                            <label for="ddlAdminRights">Role: </label>
                            <select name="roleList" id="ddlAdminRights">
                                <option value="lecturer">Lecturer</option>
                                <option value="admin">Admin</option>
                            </select>
                        </div>
                        <div id="apDiv46">
                            <input type="hidden" name="formSubmitted" value="TRUE"/>
                            <input type="submit" name="btnSubmit" id="btnSubmit" value="Submit" />
                        </div>
                    </div>

                </div>
            </form>
            <?php
            include 'SideNavigation.php';
            include 'Footer.php';
            ?>
        </center>
    </div>
    <script type="text/javascript">
        var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1");
    </script>
</body>